home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!parkbayl.demon.co.uk
- From: Martin Bayly <martin@parkbayl.demon.co.uk>
- Newsgroups: comp.lang.c++
- Subject: Problem: Passing pointer to function to Template Member function
- Date: Tue, 30 Jan 1996 13:11:14 GMT
- Organization: Park Bayly Ltd
- Message-ID: <391851586wnr@parkbayl.demon.co.uk>
- Reply-To: martin@parkbayl.demon.co.uk
- X-NNTP-Posting-Host: parkbayl.demon.co.uk
- X-Newsreader: Newswin Alpha 0.9
- X-Mail2News-Path: relay-4.mail.demon.net!post.demon.co.uk!parkbayl.demon.co.uk
-
- I have a parameterized list class. I would like one of the list class member functions to iterate
- the list and for each object, call one of the object's own member functions. Thus my class is
- defined as:
-
- template <class T>
- class List
- {
- public:
- List( );
- ~List( );
- // other functions
- > void Iterate(void (T::*pFunc)( ) );
- private:
- Node<T> itsHead;
- ULONG itsCount;
- };
-
- i.e. I'm trying to define Iterate to take a pointer to a function of the object T, whatever T happens
- to be. I get the following two compile errors (Visual C++ V4.0):
-
- error C2645: no qualified name for pointer to member (found ':: *')
- error C2629: unexpected 'void ('
-
- Any help would be greatly appreciated.
-
- --
- Martin Bayly
-
- "I need a good blast! Where's the wind?"
- --------------------------------------------------------
-
-